
#ifndef _TTG_PIPELINE_INFORMATIONS_LITE_PIPELINE_INFO_SERIALIZER_
#define _TTG_PIPELINE_INFORMATIONS_LITE_PIPELINE_INFO_SERIALIZER_
#include "Common/Definitions.h"

#include "Common/Extras.h"
#include "PipelineInfo.h"

namespace ttg_internal
{
	namespace pipeline
	{
		//Provides references (by ID) to node parameters.
		class LiteNodeInfo :public ttg::structures::SerializableObject
		{
			private:
				ttg::math::uint64 name;
				ttg::math::uint64 active_task_count;
				ttg::math::uint64 usage;
				std::vector<ttg::math::uint64> outputs;
			public:
				//Creates node info.
				LiteNodeInfo(NodeInfo *node = 0);
				//Returns ID of the corresponded parameter set.
				inline ttg::math::uint64 getName()
				{ return name; }
				//Returns ID of the parameter with count of the active tasks.
				inline ttg::math::uint64 getActiveTaskCount()
				{ return active_task_count; }
				//Returns ID of the parameter with usage value.
				inline ttg::math::uint64 getUsage()
				{ return usage; }
				//Returns vector with output nodes (IDs of the corresponded parameter sets).
				inline std::vector<ttg::math::uint64> &getOutputs()
				{ return outputs; }
				//SerializableObject member.
				virtual void serialize(ttg::extras::serialization::Serializer &serializer);
				//SerializableObject member.
				virtual void deserialize(ttg::extras::serialization::DeSerializer &deserializer);
				//Serializes given set of nodes.
				static void serializeNodes(std::vector<LiteNodeInfo> &nodes,
										   ttg::extras::serialization::Serializer &serializer);
				//DeSerialized set of nodes.
				static std::vector<LiteNodeInfo> deserializeNodes(
					ttg::extras::serialization::DeSerializer &deserializer);
		};
		//Represents sub-pipeline as set of references to corresponded parameters.
		class LiteSubPipelineInfo :public ttg::structures::SerializableObject
		{
			private:
				ttg::math::uint64 name;
				std::vector<LiteNodeInfo> nodes;
			public:
				//Creates empty sub-pipeline.
				inline LiteSubPipelineInfo()
				{ name = 0; }
				//Returns reference to corresponded parameter set.
				inline ttg::math::uint64 getName()
				{ return name; }
				//Returns nodes of current sub-pipeline.
				inline std::vector<LiteNodeInfo> &getNodes()
				{ return nodes; }
				//SerializableObject member.
				virtual void serialize(ttg::extras::serialization::Serializer &serializer);
				//SerializableObject member.
				virtual void deserialize(ttg::extras::serialization::DeSerializer &deserializer);
		};
		//Class, that provides serialization method for associated PipelineInfo.
		//"Lite" prefix means, that IDs will be serialized only (without real values).
		class LitePipelineInfo :public ttg::structures::SerializableObject
		{
			private:
				ttg::math::uint64 name;
				std::vector<LiteNodeInfo> nodes;
				std::vector<LiteSubPipelineInfo> sub_pipelines;
			public:
				//Creates serializable wrapper for given info.
				LitePipelineInfo(PipelineInfo *ref = NULL);
				//Returns ID of corresponded parameter set.
				inline ttg::math::uint64 getName()
				{ return name; }
				//Returns lite informations for nodes.
				inline std::vector<LiteNodeInfo> &getNodes()
				{ return nodes; }
				//Returns lite informations for sub-pipelines.
				inline std::vector<LiteSubPipelineInfo> &getSubPipelines()
				{ return sub_pipelines; }
				//SerializableObject member.
				virtual void serialize(ttg::extras::serialization::Serializer &serializer);
				//SerializableObject member.
				virtual void deserialize(ttg::extras::serialization::DeSerializer &deserializer);
		};
	};
}

#endif
